#include <bits/stdc++.h>

#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

typedef long long ll;

const int N = 3e6 + 10;

ll n;
int pri[N], phi[N], pnum;
bool v[N];

void init(int l) {
	phi[1] = 1;
	rep(i, 2, l) {
		if(!v[i]) pri[++pnum] = i, phi[i] = i - 1;
		rep(j, 1, pnum) {
			if(pri[j] * i > l) break;
			v[pri[j] * i] = true;
			if(i % pri[j] == 0) {
				phi[i * pri[j]] = phi[i] * pri[j];
				break;
			}
			phi[i * pri[j]] = phi[i] * phi[pri[j]];
		}
	}
}

ll calc(ll x) {
	ll res = 0;
	for(ll l = 1, r; l <= x; l = r + 1) {
		ll v = x / l; r = x / v;
		res += (r - l + 1) * v;
	}
	return res;
}

int main() {
	freopen("1.in", "r", stdin);
    init(3000000); ll n; cin >> n;
	ll ans = 0;
	rep(i, 1, n) {
		if(1ll * i * i > n) break;
		ans += phi[i] * calc(n / i / i);
	}
	cout << ans << endl; return 0;
}
